function onMapsClick(param)
{
    // 点击取消选中
    if (!geoName) {
        return;
    }
}

function getBrandSales(){
    // 参数
    jQuery.ajaxSettings.async = false;
    var params = [];
    var geoLevel = getGeoLevel(geoName);
    params.push('parameters[national_id]=' + getNationalID(geoLevel, geoName));
    params.push('parameters[geo_level]=' + geoLevel);
    params.push('parameters[year]=' + jQuery('#edit-year').val());
    params.push('parameters[geo_name]=' + (!geoName ? geoChain[geoChain.length-1] : geoName));

    jQuery.getJSON(nonghuaBaseUrl + '/api/brand_sales?' + params.join('&'), function (json) {
        optionBrands.series[0].data = json.brands;
        pieChartBrands.setOption(optionBrands, true);

        jQuery("#divBrandSales").css('display','none');
        jQuery('#myModal').modal('show');
    });
}
/*******************************图表相关************************************/
/* 饼状图选项、参数 */
var optionBrands = {
    tooltip : {
        trigger: 'item',
        formatter: "{c} ({d}%)"
    },
    calculable : false,
    series : [
        {
            type:'pie',
            radius : '55%',
            center: ['50%', '60%'],
            data:[]
        }
    ]
};

var pieChartBrands = echarts.init(document.getElementById('divBrands'));

/* 柱状图、参数 */
var optionBrandSales = {
    show : true,

    tooltip : {
        trigger: 'axis'
    },
    legend: {
        data:['近年销量']
    },
    toolbox: {
        show : false
    },
    color : [ '#00a0a0' ],
    calculable : false,
    xAxis : [
        {
            type : 'category',
            data : []
        }
    ],
    yAxis : [
        {
            type : 'value'
        }
    ],
    series : [
        {
            name: '近年销量',
            type: 'bar',
            data: []
        }
    ]
};

var barChartBrandSales = echarts.init(document.getElementById('divBrandSales'));

pieChartBrands.on(echarts.config.EVENT.CLICK, function (param) {
    jQuery.ajaxSettings.async = false;
    var params = [];
    var geoLevel = getGeoLevel(geoName);
    params.push('parameters[national_id]=' + getNationalID(geoLevel, geoName));
    params.push('parameters[geo_level]=' + geoLevel);
    params.push('parameters[year]=' + jQuery('#edit-year').val());
    params.push('parameters[geo_name]=' + geoName);

    jQuery.getJSON(nonghuaBaseUrl + '/api/brand_sales/' + param.name + '?' + params.join('&'), function (json) {
        jQuery("#divBrandSales").css('display','');
        optionBrandSales.xAxis[0].data = json.times;
        optionBrandSales.series[0].data = json.values;
        barChartBrandSales.setOption(optionBrandSales, true);
    });
});


jQuery(function($) {
    initMap("#map_previous", "#map_next");
});